package com.heima.comment.controller;

import com.heima.comment.service.CommentRepayService;
import com.heima.comment.user.dtos.ApCommentRepayLikeDto;
import com.heima.comment.user.dtos.ApCommentRepaySaveDto;
import com.heima.comment.user.dtos.ApCommentRepaySearchDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/comment_repay")
@RequiredArgsConstructor
public class CommentRepayController {

    private final CommentRepayService commentRepayService;

    /**
     * 评论回复保存
     * @param saveDto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult commentRepaySave(@RequestBody ApCommentRepaySaveDto saveDto){
        return commentRepayService.commentRepaySave(saveDto);
    }

    /**
     * 查询评论回复列表
     * @return
     */
    @PostMapping("/load")
    public ResponseResult commentRepaySearch(@RequestBody ApCommentRepaySearchDto searchDto){
        return commentRepayService.commentRepaySearch(searchDto);
    }

    /**
     * 评论回复点赞
     * @param likeDto
     * @return
     */
    @PostMapping("/like")
    public ResponseResult commentRepayLike(@RequestBody ApCommentRepayLikeDto likeDto){
        return commentRepayService.commentRepayLike(likeDto);
    }
}
